Val

Syntax: @Val string, numeric [, error_num]

The Val command converts the given string into the numeric variable.

The string parameter can be a string literal, string variable, string array, or list attribute.

The numeric parameter can be a numeric attribute, numeric variable or a numeric array.

If the data held by the variable specified by the string parameter does not contain a valid numeric value, or contains any non numeric characters, then normally a run time command error will be reported. However, an optional error_num variable can be used to trap such errors. The value of error_num will be zero when successful and hold the character position when an error is encountered, i.e. non-zero. Null strings should be trapped prior to using the Val command.

Examples:

Given that String1 = '12.345'

@Val '5.428', NumVar NumVar = 5.428

@Val String1, Num[1,1] Num[1,1] = 12.345

@Val 'Hello', NumVar, Trap NumVar = 0, Trap = 1.